<?php 
if($this->ma === 0){
     echo '<script language="javascript" type="text/javascript">alert("该状态下取件不能由您自动取消，如您真需取消，请联系悠奇客服！");location.href="member/vsdetail/?id='.$this->vsDetail->id.'";</script>';
}else if($this->ma === 1){
    echo '<script language="javascript" type="text/javascript">alert("取消成功！");location.href="member/vsdetail/?id='.$this->vsDetail->id.'";</script>';
}
?>
<div class="center">
    <div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
            <div class="weizhi">
                <h2><a href="/member/visitinglist">上门取件列表</a><i>&gt;</i>取件编号：<?php echo $this->vsDetail->visitingNo; ?></h2>
            </div>
            <div class="smxiang">
                <?php switch ($this->vsDetail->status) {
                        case Application_Model_VisitingServer::STATUS_WaitPay: ?>
                        <div class="smxtop">
                            <i class="sm_dfk">等待付款</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：等待付款</h1>
                                    <p>您的申请还没有付款，请尽快付款，以免耽误您的计划。</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="button22" href="/pay/paying/type/<?php echo Application_Model_PayBill::TYPE_Visiting;?>/id/<?php echo $this->vsDetail->id; ?>"><span>付款</span></a></li>
                                            <li><a class="smcz" href="<?php echo "?oper=cancel&id=" . ($this->vsDetail->id); ?>">取消上门</a></li>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php break;
                        case Application_Model_VisitingServer::STATUS_Processing: ?>
                        <div class="smxtop">
                            <i class="sm_ytj">您已提交申请</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：您已提交申请</h1>
                                    <p>感谢您使用上门取件服务，悠奇将尽快受理您的申请！</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="<?php echo "?oper=cancel&id=" . ($this->vsDetail->id); ?>">取消上门</a></li>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Confrimed: ?>
                        <div class="smxtop">
                            <i class="sm_ytj">已受理</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已受理</h1>
                                    <p>您的申请已受理，悠奇正在为您安排上门取件！</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>  
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Delivery: ?>
                        <div class="smxtop">
                            <i class="sm_ytj">取件途中...</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：取件途中...</h1>
                                    <p>正在为您取件并运往悠奇</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_InStore: ?>
                        <div class="smxtop" >
                            <i class="sm_yrk">已入库</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已入库</h1>
                                    <p>恭喜您！您的货物已顺利到达悠奇仓库</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Payfreight: ?>
                        <div class="smxtop" >
                            <i class="sm_yrk">补交国内运费</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已入库</h1>
                                    <p>恭喜您！您的货物已顺利到达悠奇仓库</p>
                                    <p>但是您的实际国内运费<span style="color:#c00;">（<?php echo number_format(($this->vsDetail->actualCnShipFee),2); ?>）</span>大于您交押金<span style="color:#c00;">（￥100.00）</span>。</p>
                                    <p>补交金额：<?php echo number_format(($this->vsDetail->actualCnShipFee-100),2); ?>补交链接：</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Payingmoney: ?>
                        <div class="smxtop" >
                            <i class="sm_yrk">补交国际运费</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已入库</h1>
                                    <p>恭喜您！您的货物已顺利到达悠奇仓库</p>
                                    <p>但是您的实际国际运费<span style="color:#c00;">（￥<?php echo number_format(($this->vsDetail->advanceMoney+$this->vsDetail->arrearsMoney),2); ?>）</span>大于您所交的预付款<span style="color:#c00;">（￥<?php echo number_format(($this->vsDetail->advanceMoney),2); ?>）</span>。</p>
                                    <p>补交金额：<?php echo number_format(($this->vsDetail->arrearsMoney),2); ?>补交链接：<?php echo $this->vsDetail->getPayLink(Application_Model_PayBill::TYPE_REPAY_LINK); ?></p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Launch: ?>
                        <div class="smxtop" >
                            <i class="sm_yrk">已生成国际运单</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已生成国际运单</h1>
                                    <p>您的货物顺利到达悠奇，工作人员已为您打好包并生成国际运单</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="button2" href="/member/waybillinfo/?id=<?php echo $this->vsDetail->wayId;?>"><span>查看国际运单</span></a></li>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php  break;
                        case Application_Model_VisitingServer::STATUS_Cancel: ?>
                        <div class="smxtop">
                            <i class="sm_yqx">已取消</i>
                            <div class="smgk">
                                <div class="smqhzt">
                                    <h1>目前状态：已取消</h1>
                                    <p>很遗憾！本次上门服务已取消，期待下次为您提供满意的服务！</p>
                                </div>
                                <div class="smkyi">
                                    <label>您可以：</label>
                                    <div class="kyir">
                                        <ul>
                                            <li><a class="smcz" href="/store/visiting">新申请上门</a></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                <?php } ?>
                <div class="sminfo">
                    <div class="smh2">
                        <h2>基本信息</h2>
                    </div>
                    <div class="smbiao sma1">
                        <table>
                            <tr>
                                <td class="sml">取件编号：</td>
                                <td><?php echo $this->vsDetail->visitingNo; ?></td>
                            </tr>
                            <tr>
                                <td class="sml">申请时间：</td>
                                <td><?php echo $this->vsDetail->dateCreated; ?></td>
                            </tr>
                            <tr>
                                <td class="sml">取件运输类型：</td>
                                <td><?php echo $this->vsDetail->Express->Name; ?></td>
                            </tr>
                            <tr>
                                <td class="sml">操作类型：</td>
                                <td><?php echo $this->vsDetail->isWay==1?("取件后直发海外"):"存入云仓库"; ?></td>
                            </tr>
                            <?php if($this->vsDetail->isWay==1 && $this->vsDetail->wayId != ""){ ?>
                            <tr>
                                <td class="sml">国际运单：</td>
                                <td><a href="/member/waybillinfo/?id=<?php echo $this->vsDetail->wayId;?>"><?php echo $this->vsDetail->WayBill->billNo;?></a></td>
                            </tr>
                            <?php } ?>
                            <tr>
                                <td class="sml">付款方式：</td>
                                <td>
                                    <?php if($this->vsDetail->isWay==1 && $this->vsDetail->wayId != ""){ ?>
                                        <p>支付预估运费</p>
                                    <?php }else{ ?>
                                        <p>支付保证金</p>
                                    <?php } ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="sml">支付金额：</td>
                                <td>
                                    <?php if($this->vsDetail->isWay==1 && $this->vsDetail->wayId != ""){ ?>
                                        ￥<?php echo number_format($this->vsDetail->advanceMoney,2);?><span>(此金额为预估运费，采取多退少补原则)</span>
                                    <?php }else{ ?>
                                        ￥<?php echo number_format($this->vsDetail->inlandMoney,2);?><span>(保证金可用来支付上门取件运费和国际运费)</span>
                                    <?php } ?>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="sminfo">
                    <div class="smh2">
                        <h2>物品信息</h2>
                    </div>
                    <div class="smbiao">
                        <table>
                            <tr>
                                <td class="sml">物品名称：</td>
                                <td><?php echo $this->vsDetail->waresName;?></td>
                            </tr>
                            <tr>
                                <td class="sml">物品描述：</td>
                                <td><?php echo $this->vsDetail->waresDescribe;?></td>
                            </tr>
                            <tr>
                                <td class="sml">物品重量：</td>
                                <td><?php echo $this->vsDetail->estimateWeight?$this->vsDetail->estimateWeight."g":"无";?></td>
                            </tr>
                            <tr>
                                <td class="sml">物品尺寸：</td>
                                <td><?php echo $this->vsDetail->estimateVolume?$this->vsDetail->estimateVolume."g (".$this->vsDetail->packageSize.")":"无";?></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="sminfo">
                    <div class="smh2">
                        <h2>上门取件地址</h2>
                    </div>
                    <div class="smbiao">
                        <table>
                            <tr>
                                <td class="sml">联 系 人：</td>
                                <td><?php echo $this->vsDetail->inlandUser;?></td>
                            </tr>
                            <tr>
                                <td class="sml">所在地区：</td>
                                <td><?php echo $this->vsDetail->CityByCityId->name.$this->vsDetail->TownBy->name;?></td>
                            </tr>
                            <tr>
                                <td class="sml">详细地址：</td>
                                <td><?php echo $this->vsDetail->inlandAddress;?></td>
                            </tr>
                            <tr>
                                <td class="sml">联系电话：</td>
                                <td><?php echo $this->vsDetail->inlandPhone;?></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <?php if($this->vsDetail->isWay==1 && $this->vsDetail->wayId != ""){ ?>
                <div class="sminfo">
                	<div class="smh2">
                        <h2>国外收货地址：</h2>
                    </div>
                    <div class="smbiao">
                    	<table>
                        	<tr>
                            	<td class="sml">收货联系人：</td>
                            	<td><?php echo $this->vsDetail->WayBill->consignee;?></td>
                            </tr>
                        	<tr>
                            	<td class="sml">所在国家：</td>
                            	<td><?php echo $this->vsDetail->WayBill->UserCity->name. '(' . $this->vsDetail->WayBill->UserCity->ename . ')';?></td>
                            </tr>
                        	<tr>
                            	<td class="sml">详细地址：</td>
                            	<td><?php echo $this->vsDetail->WayBill->conAdd;?></td>
                            </tr>
                        	<tr>
                            	<td class="sml">联系电话：</td>
                            	<td><?php echo $this->vsDetail->WayBill->conTel;?></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <?php } ?>
                <div class="smjianyi">
                    <p><i></i>感谢您使用上门取件服务，如您有好的意见或建议，<a href="javascript:void(0)">跟悠奇说两句</a></p>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="tanchuang" <?php echo $this->ma?($this->ma==3?"":'style="display:none;"'):'style="display:none;"';?>>
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">问题包裹</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
                <li class="wt_on"><a href="javascript:void(0)" id="problem">问题沟通</a></li>
                <li ><a href="javascript:void(0)" id="dispose">处理与进度</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box">
        <div class="wt_center">
            <?php 
                if($this->issuedetail){
                    foreach($this->issuedetail as $problemVal){ ?>
                    <div class="<?php echo $problemVal->issuetype == 1?"wt_uuch":"wt_kehu"; ?>">
                        <h2><?php echo $problemVal->issuetype == 1?"悠奇客服":'回复人：'; ?>
                            <span><?php echo $problemVal->dateCreated;?></span></h2>
                        <p><?php echo $problemVal->content;?></p>
                    </div>
            <?php } } ?>
        </div>
        <?php if($this->vsDetail->status == Application_Model_wayBillItem::STATUS_ExpressBack){ ?>
        <form method="post" action="/member/affirmvsproblem/id/<?php echo $this->vsDetail->id; ?>" id="formproblem">
            <div class="wt_caozuo">
                <textarea name="content" cols="" rows="" id="content"></textarea><a class="wt_liuyan" href="javascript:void(0)"><span>留言</span></a>
            </div>
        </form>
        <?php } ?>
    </div>
    <div class="wenti_box2" style="display:none;">
    	<div class="jinduck">
        	<h2>问题处理进度：</h2>
        </div>
        <div class="wenti_jindu">
            <table>
            	<?php 
                if($this->scheduledetail){
                    foreach($this->scheduledetail as $key => $operateVal){ ?>
                    <tr <?php echo $key==0?'class="jd_on"':"";?>>
                        <td class="wtjd_z"><p><?php echo $operateVal->dateCreated;?><i></i></p></td>
                        <td><?php echo $operateVal->content;?></td>
                    </tr>
                <?php } }?>
            </table>
        </div>
        <div class="wtgb">
        	<a class="button1" href="javascript:void(0)" id='exitproblem'><span>关闭</span></a>
        </div>
	</div>

</div>
<div class="houtai_overlay" <?php echo $this->ma?($this->ma==3?"":'style="display:none;"'):'style="display:none;"';?>></div>
<script>
    
    $("#problem_houtai").live("click",function(){
        $("div.houtai_overlay").attr("style","display:block;");
        $("div.tanchuang").attr("style","display:block;");
    });
    $(".nui-msgbox-close").live("click",function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $("div.tanchuang").attr("style","display:none;");
    });
    $("#exitproblem").live("click",function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $("div.tanchuang").attr("style","display:none;");
    });
    $("#problem").live("click",function(){
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box2").attr("style","display:none");
        $(".wenti_box").attr("style","display:block");
    });
    $("#dispose").live("click",function(){
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box").attr("style","display:none");
        $(".wenti_box2").attr("style","display:block");
    });
    $(".wt_liuyan").live("click",function(){
        var content = $("#content").val();
        if(content == ""){
            alert("原因内容不能为空");
            return false;
        }else{
            $("#formproblem").submit();
        }
    });
</script>